package com.wang.pojo;

import java.util.List;

public class Page<T>{

    public static final Integer PAGE_SIZE = 4;

    private Integer pageNo;//当前页码

    private Integer pageTotal;//总页数

    private Integer pageSize = PAGE_SIZE;//每页显示数量

    private Integer pageTotalCount;//总记录数

    private List<T> items;//当前页呈现的条目

    public String getPageUrl() {
        return pageUrl;
    }

    public void setPageUrl(String pageUrl) {
        this.pageUrl = pageUrl;
    }

    //    分页条的路径
    private String pageUrl;


    public Integer getPageSize() {
        return PAGE_SIZE;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getPageTotalCount() {
        return pageTotalCount;
    }

    public void setPageTotalCount(Integer pageTotalCount) {
        this.pageTotalCount = pageTotalCount;
    }

    public List<T> getItems() {
        return items;
    }

    public void setItems(List<T> items) {
        this.items = items;
    }

    public Integer getPageNo() {
        return pageNo;
    }

    public void setPageNo(Integer pageNo) {
        if(pageNo<1){pageNo=1;}
        else if(pageNo>pageTotal){pageNo=pageTotal;}
        this.pageNo = pageNo;
    }

    public Integer getPageTotal() {
        return pageTotal;
    }

    public void setPageTotal(Integer pageTotal) {
        this.pageTotal = pageTotal;
    }

    @Override
    public String toString() {
        return "Page{" +
                "pageNo=" + pageNo +
                ", pageTotal=" + pageTotal +
                ", pageSize=" + pageSize +
                ", pageTotalCount=" + pageTotalCount +
                ", items=" + items +
                ", pageUrl='" + pageUrl + '\'' +
                '}';
    }
}
